
<%@ page import="org.xilin.Student" %>

<div>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <g:hasErrors bean="${studentInstance}">
    <div class="errors">
      <g:renderErrors bean="${studentInstance}" as="list" />
    </div>
  </g:hasErrors>
  <g:formRemote name="saveStudent" url="${[action:'save']}" method="post" update="cluetip-inner" before="beforeSave()" onComplete="processResponse()">
    <g:hiddenField name="id" value="${studentInstance?.id}" />
    <g:hiddenField name="version" value="${studentInstance?.version}" />
    <g:hiddenField name="userId" value="${loggedInUserInfo(field:'username')}" />

    <g:hiddenField name="view" value="edit" />
    <div class="dialog">
      <table>
        <tbody>
          <tr class="prop">
            <td valign="top" class="name">
              <label for="lastName"><g:message code="student.lastName.label" default="Last Name" /></label>
            </td>
            <td valign="top" class="value ${hasErrors(bean: studentInstance, field: 'lastName', 'errors')}">
        <g:textField name="lastName" value="${studentInstance?.lastName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="firstName"><g:message code="student.firstName.label" default="First Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: studentInstance, field: 'firstName', 'errors')}">
        <g:textField name="firstName" value="${studentInstance?.firstName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="gender"><g:message code="student.gender.label" default="Gender" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: studentInstance, field: 'gender', 'errors')}">
        <g:textField name="gender" value="${studentInstance?.gender}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="chineseName"><g:message code="student.chineseName.label" default="Chinese Name" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: studentInstance, field: 'chineseName', 'errors')}">
        <g:textField name="chineseName" value="${studentInstance?.chineseName}" />
        </td>
        </tr>

        <tr class="prop">
          <td valign="top" class="name">
            <label for="birthDay"><g:message code="student.birthDay.label" default="Birth Day" /></label>
          </td>
          <td valign="top" class="value ${hasErrors(bean: studentInstance, field: 'birthDay', 'errors')}">
        <g:datePicker name="birthDay" precision="day" value="${studentInstance?.birthDay}"  />
        </td>
        </tr>

        </tbody>
      </table>
    </div>
    <div class="buttons">
      <span class="button"><g:submitButton name="save" class="save" value="${message(code: 'default.button.edit.label', default: 'Save')}" /></span>
      <span class="button"><input type="reset" value="${message(code: 'default.button.clear.label', default: 'Reset')}" /></span>
    </div>

  </g:formRemote>
</div>
